/*   1:    */ package tt.dz.web.controller.manager;
/*   2:    */ 
/*   3:    */ import com.alibaba.fastjson.JSON;
/*   4:    */ import java.util.ArrayList;
/*   5:    */ import java.util.LinkedHashMap;
/*   6:    */ import java.util.List;
/*   7:    */ import java.util.Map;
/*   8:    */ import javax.annotation.Resource;
/*   9:    */ import org.springframework.stereotype.Controller;
/*  10:    */ import org.springframework.web.bind.annotation.RequestMapping;
/*  11:    */ import org.springframework.web.bind.annotation.RequestParam;
/*  12:    */ import org.springframework.web.bind.annotation.ResponseBody;
/*  13:    */ import tt.dz.biz.service.paymentgateway.PaymentGateWayService;
/*  14:    */ import tt.dz.common.LogUtil;
/*  15:    */ import tt.dz.vo.PayGateVO;
/*  16:    */ import tt.dz.vo.ResponseModle;
/*  17:    */ 
/*  18:    */ @Controller
/*  19:    */ public class PaymentGateWayController
/*  20:    */ {
/*  21:    */   @Resource(name="paymentGateWayService")
/*  22:    */   private PaymentGateWayService paymentGateWayService;
/*  23:    */   
/*  24:    */   @RequestMapping(value={"/listSelPayChannel"}, produces={"application/json;charset=UTF-8"})
/*  25:    */   @ResponseBody
/*  26:    */   public String listSelPayChannel()
/*  27:    */   {
/*  28: 43 */     ResponseModle responseModle = null;
/*  29:    */     try
/*  30:    */     {
/*  31: 45 */       Map payChannelListMap = new LinkedHashMap();
/*  32: 46 */       List<Map<String, Object>> payChannelList = this.paymentGateWayService.getPayChannelSel();
/*  33: 47 */       for (Map<String, Object> row : payChannelList) {
/*  34: 48 */         payChannelListMap.put(row.get("channelCode"), row);
/*  35:    */       }
/*  36: 50 */       responseModle = new ResponseModle("success", payChannelListMap);
/*  37:    */     }
/*  38:    */     catch (Exception e)
/*  39:    */     {
/*  40: 52 */       LogUtil.error("查询支付渠道发生异常", e);
/*  41: 53 */       responseModle = new ResponseModle("error", new ArrayList());
/*  42:    */     }
/*  43: 55 */     return JSON.toJSONString(responseModle);
/*  44:    */   }
/*  45:    */   
/*  46:    */   @RequestMapping(value={"/listSelMerchant"}, produces={"application/json;charset=UTF-8"})
/*  47:    */   @ResponseBody
/*  48:    */   public String listSelMerchant()
/*  49:    */   {
/*  50: 63 */     ResponseModle responseModle = null;
/*  51:    */     try
/*  52:    */     {
/*  53: 65 */       Map merchantListMap = new LinkedHashMap();
/*  54: 66 */       List<Map<String, Object>> merchantList = this.paymentGateWayService.getMerchantSel();
/*  55: 67 */       for (Map<String, Object> row : merchantList) {
/*  56: 68 */         merchantListMap.put(row.get("merchantCode"), row);
/*  57:    */       }
/*  58: 70 */       responseModle = new ResponseModle("success", merchantListMap);
/*  59:    */     }
/*  60:    */     catch (Exception e)
/*  61:    */     {
/*  62: 72 */       LogUtil.error("查询运商发生异常", e);
/*  63: 73 */       responseModle = new ResponseModle("error", new ArrayList());
/*  64:    */     }
/*  65: 75 */     return JSON.toJSONString(responseModle);
/*  66:    */   }
/*  67:    */   
/*  68:    */   @RequestMapping(value={"/listAllPaymentGateway"}, produces={"application/json;charset=UTF-8"})
/*  69:    */   @ResponseBody
/*  70:    */   public String listAllPaymentGateway()
/*  71:    */   {
/*  72: 83 */     ResponseModle responseModle = null;
/*  73:    */     try
/*  74:    */     {
/*  75: 85 */       List<PayGateVO> payGatelist = this.paymentGateWayService.getPayGateList(null);
/*  76: 86 */       responseModle = new ResponseModle("success", payGatelist);
/*  77:    */     }
/*  78:    */     catch (Exception e)
/*  79:    */     {
/*  80: 88 */       LogUtil.error("查询支付网关发生异常", e);
/*  81: 89 */       responseModle = new ResponseModle("error", new ArrayList());
/*  82:    */     }
/*  83: 91 */     return JSON.toJSONString(responseModle);
/*  84:    */   }
/*  85:    */   
/*  86:    */   @RequestMapping(value={"/getPaymentGateway"}, produces={"application/json;charset=UTF-8"})
/*  87:    */   @ResponseBody
/*  88:    */   public String getPaymentGateway(@RequestParam("merchantCode") String merchantCode, @RequestParam("channelCode") String channelCode)
/*  89:    */   {
/*  90:100 */     ResponseModle responseModle = null;
/*  91:    */     try
/*  92:    */     {
/*  93:102 */       PayGateVO payGateVO = this.paymentGateWayService.getMsPayGateVO(merchantCode, channelCode);
/*  94:103 */       responseModle = new ResponseModle("success", payGateVO);
/*  95:    */     }
/*  96:    */     catch (Exception e)
/*  97:    */     {
/*  98:105 */       LogUtil.error("修改支付网关发生异常", e);
/*  99:106 */       responseModle = new ResponseModle("error", new Object());
/* 100:    */     }
/* 101:108 */     return JSON.toJSONString(responseModle);
/* 102:    */   }
/* 103:    */   
/* 104:    */   @RequestMapping(value={"/savePaymentGateway"}, produces={"application/json;charset=UTF-8"})
/* 105:    */   @ResponseBody
/* 106:    */   public String savePaymentGateway(@RequestParam("payGateJSON") String payGateJSON)
/* 107:    */   {
/* 108:116 */     ResponseModle responseModle = null;
/* 109:    */     try
/* 110:    */     {
/* 111:118 */       PayGateVO payGateVO = (PayGateVO)JSON.parseObject(payGateJSON, PayGateVO.class);
/* 112:119 */       int result = this.paymentGateWayService.savePayGate(payGateVO);
/* 113:120 */       responseModle = new ResponseModle("success", Integer.valueOf(result));
/* 114:    */     }
/* 115:    */     catch (Exception e)
/* 116:    */     {
/* 117:122 */       LogUtil.error("保存支付网关发生异常", e);
/* 118:123 */       responseModle = new ResponseModle("error", Integer.valueOf(0));
/* 119:    */     }
/* 120:125 */     return JSON.toJSONString(responseModle);
/* 121:    */   }
/* 122:    */   
/* 123:    */   @RequestMapping(value={"/checkPayGateExists"}, produces={"application/json;charset=UTF-8"})
/* 124:    */   @ResponseBody
/* 125:    */   public String checkPayGateExists(@RequestParam("merchantCode") String merchantCode, @RequestParam("channelCode") String channelCode)
/* 126:    */     throws Exception
/* 127:    */   {
/* 128:141 */     ResponseModle responseModle = new ResponseModle("success", Boolean.valueOf(this.paymentGateWayService.checkPayGateExists(merchantCode, channelCode)));
/* 129:142 */     return JSON.toJSONString(responseModle);
/* 130:    */   }
/* 131:    */ }


/* Location:           F:\work\pengyu\mainServer\WEB-INF\classes\
 * Qualified Name:     tt.dz.web.controller.manager.PaymentGateWayController
 * JD-Core Version:    0.7.0.1
 */